(function(g) {

    var X = Object.create(null);

    var eventDescriptor = {
        value: function() {
            var current = arguments.callee; // 取当前函数的引用

            var caller;
            do {
                caller = current.caller; // 获得当前函数的调用者
                // 输出当前函数及其调用者
                console.log(current.name ? current.name : 'anonymous', caller ? caller.name : null);
                current = caller ? caller : current;
            } while (caller != null);

            return current.arguments[0];
        }
    }

    Object.defineProperty(X, 'event', eventDescriptor);

    var targetDescriptor = {
        value: function() {
            var e = X.event();
            return e.target || e.srcElement;
        }
    }

    Object.defineProperty(X, 'target', targetDescriptor);

    if (g.X) {
        Object.assign(g.X, X);
    } else {
        g.X = X;
    }
})(window);